@model VotingSystem.ViewModels.UserProfileViewModel

@{
    ViewData["Title"] = "个人资料";
}

<div class="container">
    <div class="row justify-content-center">
        <div class="col-md-8">
            <div class="card shadow-sm">
                <div class="card-body">
                    @if (TempData["SuccessMessage"] != null)
                    {
                        <div class="alert alert-success alert-dismissible fade show" role="alert">
                            <i class="fas fa-check-circle me-2"></i>@TempData["SuccessMessage"]
                            <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
                        </div>
                    }
                    
                    <h2 class="card-title text-center mb-4">
                        <i class="fas fa-user-circle"></i> @ViewData["Title"]
                    </h2>

                    <div class="row mb-4">
                        <div class="col-md-4 text-center">
                            <div class="avatar-circle mb-3">
                                <i class="fas fa-user fa-3x"></i>
                            </div>
                            <h5>@Model.UserName</h5>
                        </div>
                        <div class="col-md-8">
                            <div class="mb-3">
                                <label class="form-label text-muted">邮箱</label>
                                <p class="form-control-plaintext">@Model.Email</p>
                            </div>
                            <div class="mb-3">
                                <label class="form-label text-muted">注册时间</label>
                                <p class="form-control-plaintext">@Model.RegisterTime.ToString("yyyy-MM-dd HH:mm")</p>
                            </div>
                        </div>
                    </div>

                    <div class="row text-center mb-4">
                        <div class="col-md-6">
                            <div class="card bg-light">
                                <div class="card-body">
                                    <h3 class="text-primary">@Model.CreatedVotesCount</h3>
                                    <p class="text-muted mb-0">创建的投票</p>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="card bg-light">
                                <div class="card-body">
                                    <h3 class="text-success">@Model.ParticipatedVotesCount</h3>
                                    <p class="text-muted mb-0">参与的投票</p>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="d-grid gap-2">
                        <a asp-action="EditProfile" class="btn btn-primary">
                            <i class="fas fa-user-edit"></i> 编辑个人资料
                        </a>
                        <a asp-action="ChangePassword" class="btn btn-primary">
                            <i class="fas fa-key"></i> 修改密码
                        </a>
                        <a asp-controller="Vote" asp-action="MyVotes" class="btn btn-outline-primary">
                            <i class="fas fa-list"></i> 我的投票
                        </a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<style>
    .avatar-circle {
        width: 100px;
        height: 100px;
        background-color: #e9ecef;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        margin: 0 auto;
        color: #6c757d;
    }
</style> 

@section Scripts {
    <script>
        $(document).ready(function() {
            // 自动隐藏提示消息
            $('.alert').delay(4000).fadeOut(500);
        });
    </script>
} 